#define _CRT_SECURE_NO_WARNINGS
#include <vector>
#include <iostream>
using namespace std;

class Solution {
public:
    int removeDuplicates(vector<int>& nums) {
        int num = nums[0];
        int i = 1;
        for (auto e : nums)
        {
            if (e != num)
            {
                num = e;
                nums[i++] = e;
            }
        }
        return i;
    }
};

class Solution {
public:
    vector<int> singleNumber(vector<int>& nums) {
        int xorsum = 0;
        for (int num : nums)
        {
            xorsum ^= num;
        }
        int lsb = (xorsum & (-xorsum));
        int type1 = 0, type2 = 0;
        for (int num : nums)
        {
            if (num & lsb)
            {
                type1 ^= num;
            }
            else
            {
                type2 ^= num;
            }
        }


        return { type1,type2 };
    }
};
